
  <div class="x_panel">
    <div class="x_content" style="display: block;">
      <!--表格主体内容-->
      <div class="nav navbar-right panel_toolbox">
        <a class="fa fa-plus" href="/channel/add.html"> 添加</a>
      </div>
      <br>
      <div class="row-fluid">
        <form action="/channel/index.html" method="get">
            <label class="control-label">渠道名称</label>
            <input type="text" class="form-control-new" name="form[channel_name]" value="{if isset($query.channel_name)}{$query.channel_name}{/if}">
            <label class="control-label">渠道码</label>
            <input type="text" class="form-control-new" name="form[channel_code]" value="{if isset($query.channel_code)}{$query.channel_code}{/if}">
             <button type="submit" class="btn btn-primary" >搜索</button>
        </form>
      </div>
      <br>
      <div class="cont">
        <table class="table table-bordered table-striped">
          <thead>
          <tr>
            <th width="100px">渠道ID</th>
            <th>渠道名称</th>
            <th>渠道码</th>
            <th>操作</th>
          </tr>
          </thead>
          <tbody>
          {foreach $channel.lists as $channelitem}
          <tr>
            <td>{$channelitem.channel_id}</td>
            <td>{$channelitem.channel_name}</td>
            <td>{$channelitem.channel_code}</td>
            <td>
              <div class="x_content">
                <button id="seelink" class="btn btn-primary btn-xs" data="{$channelitem.channel_link}"> 查看链接</button>
                <button class="btn btn-danger btn-xs" data-toggle="dropdown">删除
                  <i class="icon-angle-down"></i></button>
                <ul class="dropdown-menu">
                  <li><a href="{eval U(['channel/delete','channel_id'=>$channelitem.channel_id])}">确定</a></li>
                  <li><a href="javascript:;">取消</a></li>
                </ul>
              </div>
            </td>
          </tr>
          {/foreach}
          </tbody>
        </table>
        <!--分页-->

        {Yii::$app->view->render('/com/pager.php',['pager'=>$channel['pager']])}
      </div>

      <div class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" aria-hidden="true" id="detail-modal">
        <div class="modal-dialog modal-lg">
          <div class="modal-content">

            <div class="modal-header" style="border:none">
              <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span></button>
              <h4 class="modal-title" id="myModalLabel">商城链接</h4>
            </div>
            <div class="modal-body">
              <div class="loaders">
                <div class="ball-spin-fade-loader">
                  <input class="form-control" id="link" type="text" readonly="readonly" value="">
                </div>
              </div>
              <div id="modal-dyn"></div>
            </div>
            <div class="modal-footer" style="border:none;">
              <button id="copy" type="button" class="copy btn btn-secondary" data-clipboard-target="#link">复制</button>
              <button type="button" class="btn btn-secondary" data-dismiss="modal">关闭</button>
            </div>
          </div>
        </div>
      </div>


    </div>
  </div>
  <script src="{$theme}/libs/js/clipboard/clipboard.min.js"></script>
<script>
  $("#seelink").click(function () {
      var data = $(this).attr("data");
      $("#link").val(data);
      $('#detail-modal').modal('show');
  })
  var clipboard = new ClipboardJS('.copy');

  clipboard.on('success', function(e) {
      alert("复制成功")
  });

  clipboard.on('error', function(e) {
      console.log(e);
  });
  /*$("#copy").click(function () {
      clipBoardContent = $("#link").val();
      window.clipboardData.setData("Text",clipBoardContent);
      alert("复制成功！")
  })*/

</script>
